<?php
/**
 * Copyright (C), 2016-2018, Shall Buy Life info. Co., Ltd.
 * FileName: EarnestPayCallback.php
 * Description: 支付回调-订金
 *
 * @author zyn
 * @Create Date: 2020/7/20
 * @Update Date: 2020/7/20 By zyn
 * @version v1.0
 */

namespace Example\Services\Processor\Order;

use Illuminate\Http\Response;
use YiluTech\YiMQ\Processor\EcProcessor;

class OrderRefundCallback extends EcProcessor
{

    protected function validate($validator)
    {
        $validator([
            'refund_sn' => 'required',
        ]);
    }

    /**
     * FunctionName：do
     * Description：
     * Author：lwl
     * @return bool[]
     */
    protected function do()
    {
        $order = $this->data;
        $result = RefundService::getInstance()->callBack($order);
        if ($result['code'] != Response::HTTP_OK) {
            return ['result' => false];
        }
        return ['result' => true];
    }
}
